using Project_Schedule.Domain.BackGround.com.core.dto;

namespace Project_Schedule.Domain.BackGround.com.core.utils;

public static class CreateUserCheckout
{
    public static bool BackgroundUserInfomationCheck(
        BackgroundCreateUser user, out string message)
    {
        message = string.Empty;
        if (user.Account?.Length is < 5 or > 10)
        {
            message = "账户长度应为5～10";
            return false;
        }

        if (user.Password?.Length is < 5 or > 20)
        {
            message = "密码长度应为5～20";
            return false;
        }

        if (user.UserName?.Length is < 1 or > 4)
        {
            message = "用户名长度为2～4";
            return false;
        }

        if (user.Auth is 0 or 1) return true;
        message = "权限设置出错";
        return false;
    }
}